package xaj.scc.ast;

import java.util.Iterator;
import java.util.List;

import polyglot.ast.ClassMember;
import polyglot.ast.Ext;
import polyglot.ast.JL;
import polyglot.ext.jl.ast.Node_c;
import polyglot.util.CodeWriter;
import polyglot.util.Position;
import polyglot.visit.PrettyPrinter;

public class OnWeaving_c extends Node_c implements OnWeaving {
	//Position pos;
	String name;
	List<ClassMember> productions;
	
	public OnWeaving_c(Position pos, String name, List<ClassMember> productions) {
		// TODO Auto-generated constructor stub
		super(pos);
		System.out.println("Criou elemento OnWeaving!");
		//this.pos = pos;
		this.name = name;
		this.productions = productions;

	}
	
	/*public OnWeaving_c() {
		// TODO Auto-generated constructor stub
		//super(pos);
	}*/
	
	public Position getPos() {
		return position;
	}
	
	public String getName() {
		return name;
	}
	
	public List<ClassMember> getProductions() {
		return productions;
	}
	
	public void prettyPrint(CodeWriter w, PrettyPrinter tr) {
		w.newline(4);
		w.begin(0);
		w.write("@onWeaving " + name);
		w.write(" {");
		w.newline(4);
		w.begin(0);
		for(ClassMember p : productions) {
			w.begin(0);
			p.prettyPrint(w, tr);
			w.end();
		}
		w.end();
		w.newline();
		w.write("}");
		w.end();
	}
	
	/*
	@Override
	public OnWeaving del(JL delOnWeaving) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public OnWeaving ext(Ext extOnWeaving) {
		// TODO Auto-generated method stub
		return null;
	}
	*/
	
	@Override
	public void accept(Visitor v) {
		System.out.println("Chamou accept em OnWeaving!");
		v.visit(this);
	}
	
}
